<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:include page="${pageContext.request.contextPath}/include/pageTitleBread.jsp"/>
<div id="page-content">
    <div class="col-lg-12">
        <div class="panel">
            <div class="panel-heading">
                <h3 class="panel-title">${pageInfo.innerTitle}</h3>
            </div>
            <form id="cstInfoForm" class="panel-body form-horizontal form-padding">

                <div class="form-group">
                    <label class="col-sm-3 control-label">客户头像：</label>
                    <div class="col-sm-5">
                        <input id="flAvatar" name="flAvatar" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户姓名：</label>
                    <div class="col-sm-5">
                        <input id="flName" name="flName" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户性别：</label>
                    <div class="col-sm-5">
                        <input id="sex0" class="magic-radio" type="radio" name="flSex"
                               value="0" checked>
                        <label for="sex0">女</label>
                        <input id="sex1" class="magic-radio" type="radio" name="flSex"
                               value="1">
                        <label for="sex1">男</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户手机：</label>
                    <div class="col-sm-5">
                        <input id="flPhone" name="flPhone" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">登录密码：</label>
                    <div class="col-sm-5">
                        <input id="flLoginPwd" name="flLoginPwd" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户邮箱：</label>
                    <div class="col-sm-5">
                        <input id="flEmail" name="flEmail" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户类型：</label>
                    <div class="col-sm-5">
                        <input id="type0" class="magic-radio" type="radio" name="flType"
                               value="0">
                        <label for="type0">体验客户</label>
                        <input id="type1" class="magic-radio" type="radio" name="flType"
                               value="1" checked>
                        <label for="type1">付费客户</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户剩余体验天数：</label>
                    <div class="col-sm-5">
                        <input id="flLaveDay" name="flLaveDay" class="form-control" type="text" placeholder="-1为永久使用">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">用户角色：</label>
                    <div class="col-sm-5">
                        <select name="flRoleId" id="flRoleId" class="form-control">
                            <option value="1">默认角色</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户已支付金额：</label>
                    <div class="col-sm-5">
                        <input id="flPaidAmount" name="flPaidAmount" class="form-control" type="text">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">客户支付时间：</label>
                    <div class="col-sm-5">
                        <input id="flPaidTime" name="flPaidTime" class="form-control" type="text"
                               placeholder="格式为:2018-06-20 16:11:00">
                    </div>
                </div>
                <div class="panel-footer">
                    <div class="row">
                        <div class="col-sm-9 col-sm-offset-3">
                            <button class="btn btn-warning" type="reset">重置</button>
                            <button class="btn btn-mint" type="submit">保存</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>

    function save() {
        var data = common_ajax.ajaxFunc("/cstInfo/saveOrUpdate", $('#cstInfoForm').serialize(), "json", null);
        if (data.code === 0) {
            pointLion.alertMsg("保存成功!", "success", "small", function () {
                doPjax(ctx + '/cstInfo');//跳转到列表页
            });
        } else {
            pointLion.alertMsg("操作失败!", "danger", "small", function () {
                doPjax(ctx + '/cstInfo');//跳转到列表页
            });
        }
    }

    $(document).ready(function () {
        common_ajax.initCombo("flRoleId","${pageContext.request.contextPath}/sysRole/initSelect",-1);
        $('#cstInfoForm').bootstrapValidator({
            excluded: [":hidden"],//关键配置，表示只对于隐藏域不进行验证，其他的表单元素都要验证
            fields: {
                "fl_code": {
                    validators: {
                        notEmpty: {
                            message: '*XXXX不能为空!'
                        },
                        stringLength: {
                            min: 2,
                            message: '*XXXX必须大于两位'
                        }
                    }
                },
                "fl_name": {
                    validators: {
                        notEmpty: {
                            message: '*XXXX不能为空'
                        },
                        stringLength: {
                            min: 2,
                            message: '*XXXX必须大于两位'
                        }
                    }
                }
            }
        }).on("success.form.bv", function (e) {
            save();
            return false;//阻止表单跳转
        });
    });
</script>
